<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    正在测试jq的get请求
    <input type="button" id="btn1" value="get请求商品数据">
    <input type="button" id="btn2" value="post请求轮播图数据">
</body>
<script src="./libs/jquery.js"></script>
<script>
    // $.get(url,data,success,dataType);

    $("#btn1").on("click",function(){
        const result = $.get("http://localhost:3000/api",{
            type:"getGoods"
        },function(res, status, xhr){
            console.log(res);
            console.log(status)
            console.log(xhr)
        },"text");
        
        // console.log(result);

        result.error(function(xhr, status, msg){
            console.log(xhr);
            console.log(status);
            console.log(msg);
        })
    })


    $("#btn2").on("click",function(){
        const result = $.post("http://localhost:3000/api",{
            type:"getBanner"
        },function(res, status, xhr){
            console.log(res);
        });
    })

</script>
</html>